/**
 * 
 */
document.onkeydown = function(event_e) {
	if (window.event)
		event_e = window.event;
	var int_keycode = event_e.charCode || event_e.keyCode;
	if (int_keycode == 13) {
		userLogin();
	}
};

function keysubmit(e) {
	if (e.which == 13 || event.keyCode == 13) {
		userLogin();
	}
}
function setFocus(){
	document.getElementById("nickname").focus();
}
function userLogin() {
	var divPrompt = document.getElementById("divPrompt");
	var nickname = document.getElementById("nickname").value;
	var password = document.getElementById("password").value;
	if (nickname == '') {
		divPrompt.innerHTML = "<li>用户名不能为空</li>";
		return false;
	}
	if (password == '') {
		divPrompt.innerHTML = "<li>密码不能为空</li>";
		return false;
	}
	if (nickname.length > 15){
		divPrompt.innerHTML = "<li>用户名太长，长度要小于16</li>";
		return false;
	}
	if (password.length > 15){
		divPrompt.innerHTML = "<li>密码太长，密码长度要小于16</li>";
		return false;
	}
	if (password.length < 5){
		divPrompt.innerHTML = "<li>密码太短，密码长度要大于4</li>";
		return false;
	}
	document.getElementById("frm").submit();
}
function toReset() {
	document.getElementById("nickname").value = "";
	document.getElementById("password").value = "";
	document.getElementById("divPrompt").innerHTML = "";
}
function clearDivPrompt(){
	document.getElementById("divPrompt").innerHTML = "";
	//document.getElementById("divPrompt2").innerHTML = "";
}